JQuery การใช้ each(iterator) หรือ $("selector").each()
each(iterator)
Description Original : Traverses all elements in the matched set, invoking the passed iterator function for each.
คำอธิบายเสริม : กระจาย wrapper set คล้าย foreach ลงใน iterator ตัวชี้ iterator สามารถระบุ ตัวแหน่งของแต่ละ element ได้ พูดง่ายๆก็คือ ทำให้ค่าที่เรา Select ที่ได้จาก Jquery selector มาวนลูปเรียกทีละตัวนั้นเอง
Parameters
iterator (Function) A function called for each element in the matched set. Two parameters
are passed to this function: the zero-based index of the element within the set,
and the element itself. The element is also established as the function context
(the this reference).
Returns
The wrapped set.
ตัวอย่าง
each(iterator) :
Source Item :
item5
item6
item7
item8
Contact with developer :